/*****************************************************************************
 *   Copyright(C)2009-2022 by VSF Team                                       *
 *                                                                           *
 *  Licensed under the Apache License, Version 2.0 (the "License");          *
 *  you may not use this file except in compliance with the License.         *
 *  You may obtain a copy of the License at                                  *
 *                                                                           *
 *     http://www.apache.org/licenses/LICENSE-2.0                            *
 *                                                                           *
 *  Unless required by applicable law or agreed to in writing, software      *
 *  distributed under the License is distributed on an "AS IS" BASIS,        *
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
 *  See the License for the specific language governing permissions and      *
 *  limitations under the License.                                           *
 *                                                                           *
 ****************************************************************************/

#ifndef __VSF_MACRO_CALC_H__
#define __VSF_MACRO_CALC_H__

/*============================ INCLUDES ======================================*/

#ifdef __cplusplus
extern "C" {
#endif

/*============================ MACROS ========================================*/

#define VSF_MCAT2_PRIMITIVE(__X, ...)           __X##__VA_ARGS__
#define VSF_MCAT2(__X, ...)                     VSF_MCAT2_PRIMITIVE(__X, __VA_ARGS__)

#define VSF_MINC_LIMIT                          256
#define VSF_MINC(__X)                           VSF_MCAT2_PRIMITIVE(__VSF_MINC_, __X)
#define __VSF_MINC_0                            1
#define __VSF_MINC_1                            2
#define __VSF_MINC_2                            3
#define __VSF_MINC_3                            4
#define __VSF_MINC_4                            5
#define __VSF_MINC_5                            6
#define __VSF_MINC_6                            7
#define __VSF_MINC_7                            8
#define __VSF_MINC_8                            9
#define __VSF_MINC_9                            10
#define __VSF_MINC_10                           11
#define __VSF_MINC_11                           12
#define __VSF_MINC_12                           13
#define __VSF_MINC_13                           14
#define __VSF_MINC_14                           15
#define __VSF_MINC_15                           16
#define __VSF_MINC_16                           17
#define __VSF_MINC_17                           18
#define __VSF_MINC_18                           19
#define __VSF_MINC_19                           20
#define __VSF_MINC_20                           21
#define __VSF_MINC_21                           22
#define __VSF_MINC_22                           23
#define __VSF_MINC_23                           24
#define __VSF_MINC_24                           25
#define __VSF_MINC_25                           26
#define __VSF_MINC_26                           27
#define __VSF_MINC_27                           28
#define __VSF_MINC_28                           29
#define __VSF_MINC_29                           30
#define __VSF_MINC_30                           31
#define __VSF_MINC_31                           32
#define __VSF_MINC_32                           33
#define __VSF_MINC_33                           34
#define __VSF_MINC_34                           35
#define __VSF_MINC_35                           36
#define __VSF_MINC_36                           37
#define __VSF_MINC_37                           38
#define __VSF_MINC_38                           39
#define __VSF_MINC_39                           40
#define __VSF_MINC_40                           41
#define __VSF_MINC_41                           42
#define __VSF_MINC_42                           43
#define __VSF_MINC_43                           44
#define __VSF_MINC_44                           45
#define __VSF_MINC_45                           46
#define __VSF_MINC_46                           47
#define __VSF_MINC_47                           48
#define __VSF_MINC_48                           49
#define __VSF_MINC_49                           50
#define __VSF_MINC_50                           51
#define __VSF_MINC_51                           52
#define __VSF_MINC_52                           53
#define __VSF_MINC_53                           54
#define __VSF_MINC_54                           55
#define __VSF_MINC_55                           56
#define __VSF_MINC_56                           57
#define __VSF_MINC_57                           58
#define __VSF_MINC_58                           59
#define __VSF_MINC_59                           60
#define __VSF_MINC_60                           61
#define __VSF_MINC_61                           62
#define __VSF_MINC_62                           63
#define __VSF_MINC_63                           64
#define __VSF_MINC_64                           65
#define __VSF_MINC_65                           66
#define __VSF_MINC_66                           67
#define __VSF_MINC_67                           68
#define __VSF_MINC_68                           69
#define __VSF_MINC_69                           70
#define __VSF_MINC_70                           71
#define __VSF_MINC_71                           72
#define __VSF_MINC_72                           73
#define __VSF_MINC_73                           74
#define __VSF_MINC_74                           75
#define __VSF_MINC_75                           76
#define __VSF_MINC_76                           77
#define __VSF_MINC_77                           78
#define __VSF_MINC_78                           79
#define __VSF_MINC_79                           80
#define __VSF_MINC_80                           81
#define __VSF_MINC_81                           82
#define __VSF_MINC_82                           83
#define __VSF_MINC_83                           84
#define __VSF_MINC_84                           85
#define __VSF_MINC_85                           86
#define __VSF_MINC_86                           87
#define __VSF_MINC_87                           88
#define __VSF_MINC_88                           89
#define __VSF_MINC_89                           90
#define __VSF_MINC_90                           91
#define __VSF_MINC_91                           92
#define __VSF_MINC_92                           93
#define __VSF_MINC_93                           94
#define __VSF_MINC_94                           95
#define __VSF_MINC_95                           96
#define __VSF_MINC_96                           97
#define __VSF_MINC_97                           98
#define __VSF_MINC_98                           99
#define __VSF_MINC_99                           100
#define __VSF_MINC_100                          101
#define __VSF_MINC_101                          102
#define __VSF_MINC_102                          103
#define __VSF_MINC_103                          104
#define __VSF_MINC_104                          105
#define __VSF_MINC_105                          106
#define __VSF_MINC_106                          107
#define __VSF_MINC_107                          108
#define __VSF_MINC_108                          109
#define __VSF_MINC_109                          110
#define __VSF_MINC_110                          111
#define __VSF_MINC_111                          112
#define __VSF_MINC_112                          113
#define __VSF_MINC_113                          114
#define __VSF_MINC_114                          115
#define __VSF_MINC_115                          116
#define __VSF_MINC_116                          117
#define __VSF_MINC_117                          118
#define __VSF_MINC_118                          119
#define __VSF_MINC_119                          120
#define __VSF_MINC_120                          121
#define __VSF_MINC_121                          122
#define __VSF_MINC_122                          123
#define __VSF_MINC_123                          124
#define __VSF_MINC_124                          125
#define __VSF_MINC_125                          126
#define __VSF_MINC_126                          127
#define __VSF_MINC_127                          128
#define __VSF_MINC_128                          129
#define __VSF_MINC_129                          130
#define __VSF_MINC_130                          131
#define __VSF_MINC_131                          132
#define __VSF_MINC_132                          133
#define __VSF_MINC_133                          134
#define __VSF_MINC_134                          135
#define __VSF_MINC_135                          136
#define __VSF_MINC_136                          137
#define __VSF_MINC_137                          138
#define __VSF_MINC_138                          139
#define __VSF_MINC_139                          140
#define __VSF_MINC_140                          141
#define __VSF_MINC_141                          142
#define __VSF_MINC_142                          143
#define __VSF_MINC_143                          144
#define __VSF_MINC_144                          145
#define __VSF_MINC_145                          146
#define __VSF_MINC_146                          147
#define __VSF_MINC_147                          148
#define __VSF_MINC_148                          149
#define __VSF_MINC_149                          150
#define __VSF_MINC_150                          151
#define __VSF_MINC_151                          152
#define __VSF_MINC_152                          153
#define __VSF_MINC_153                          154
#define __VSF_MINC_154                          155
#define __VSF_MINC_155                          156
#define __VSF_MINC_156                          157
#define __VSF_MINC_157                          158
#define __VSF_MINC_158                          159
#define __VSF_MINC_159                          160
#define __VSF_MINC_160                          161
#define __VSF_MINC_161                          162
#define __VSF_MINC_162                          163
#define __VSF_MINC_163                          164
#define __VSF_MINC_164                          165
#define __VSF_MINC_165                          166
#define __VSF_MINC_166                          167
#define __VSF_MINC_167                          168
#define __VSF_MINC_168                          169
#define __VSF_MINC_169                          170
#define __VSF_MINC_170                          171
#define __VSF_MINC_171                          172
#define __VSF_MINC_172                          173
#define __VSF_MINC_173                          174
#define __VSF_MINC_174                          175
#define __VSF_MINC_175                          176
#define __VSF_MINC_176                          177
#define __VSF_MINC_177                          178
#define __VSF_MINC_178                          179
#define __VSF_MINC_179                          180
#define __VSF_MINC_180                          181
#define __VSF_MINC_181                          182
#define __VSF_MINC_182                          183
#define __VSF_MINC_183                          184
#define __VSF_MINC_184                          185
#define __VSF_MINC_185                          186
#define __VSF_MINC_186                          187
#define __VSF_MINC_187                          188
#define __VSF_MINC_188                          189
#define __VSF_MINC_189                          190
#define __VSF_MINC_190                          191
#define __VSF_MINC_191                          192
#define __VSF_MINC_192                          193
#define __VSF_MINC_193                          194
#define __VSF_MINC_194                          195
#define __VSF_MINC_195                          196
#define __VSF_MINC_196                          197
#define __VSF_MINC_197                          198
#define __VSF_MINC_198                          199
#define __VSF_MINC_199                          200
#define __VSF_MINC_200                          201
#define __VSF_MINC_201                          202
#define __VSF_MINC_202                          203
#define __VSF_MINC_203                          204
#define __VSF_MINC_204                          205
#define __VSF_MINC_205                          206
#define __VSF_MINC_206                          207
#define __VSF_MINC_207                          208
#define __VSF_MINC_208                          209
#define __VSF_MINC_209                          210
#define __VSF_MINC_210                          211
#define __VSF_MINC_211                          212
#define __VSF_MINC_212                          213
#define __VSF_MINC_213                          214
#define __VSF_MINC_214                          215
#define __VSF_MINC_215                          216
#define __VSF_MINC_216                          217
#define __VSF_MINC_217                          218
#define __VSF_MINC_218                          219
#define __VSF_MINC_219                          220
#define __VSF_MINC_220                          221
#define __VSF_MINC_221                          222
#define __VSF_MINC_222                          223
#define __VSF_MINC_223                          224
#define __VSF_MINC_224                          225
#define __VSF_MINC_225                          226
#define __VSF_MINC_226                          227
#define __VSF_MINC_227                          228
#define __VSF_MINC_228                          229
#define __VSF_MINC_229                          230
#define __VSF_MINC_230                          231
#define __VSF_MINC_231                          232
#define __VSF_MINC_232                          233
#define __VSF_MINC_233                          234
#define __VSF_MINC_234                          235
#define __VSF_MINC_235                          236
#define __VSF_MINC_236                          237
#define __VSF_MINC_237                          238
#define __VSF_MINC_238                          239
#define __VSF_MINC_239                          240
#define __VSF_MINC_240                          241
#define __VSF_MINC_241                          242
#define __VSF_MINC_242                          243
#define __VSF_MINC_243                          244
#define __VSF_MINC_244                          245
#define __VSF_MINC_245                          246
#define __VSF_MINC_246                          247
#define __VSF_MINC_247                          248
#define __VSF_MINC_248                          249
#define __VSF_MINC_249                          250
#define __VSF_MINC_250                          251
#define __VSF_MINC_251                          252
#define __VSF_MINC_252                          253
#define __VSF_MINC_253                          254
#define __VSF_MINC_254                          255
#define __VSF_MINC_255                          256
#define __VSF_MINC_256                          257

#define VSF_MDEC_LIMIT                          256
#define VSF_MDEC(__X)                           VSF_MCAT2_PRIMITIVE(__VSF_MDEC_, __X)
#define __VSF_MDEC_0                            0
#define __VSF_MDEC_1                            0
#define __VSF_MDEC_2                            1
#define __VSF_MDEC_3                            2
#define __VSF_MDEC_4                            3
#define __VSF_MDEC_5                            4
#define __VSF_MDEC_6                            5
#define __VSF_MDEC_7                            6
#define __VSF_MDEC_8                            7
#define __VSF_MDEC_9                            8
#define __VSF_MDEC_10                           9
#define __VSF_MDEC_11                           10
#define __VSF_MDEC_12                           11
#define __VSF_MDEC_13                           12
#define __VSF_MDEC_14                           13
#define __VSF_MDEC_15                           14
#define __VSF_MDEC_16                           15
#define __VSF_MDEC_17                           16
#define __VSF_MDEC_18                           17
#define __VSF_MDEC_19                           18
#define __VSF_MDEC_20                           19
#define __VSF_MDEC_21                           20
#define __VSF_MDEC_22                           21
#define __VSF_MDEC_23                           22
#define __VSF_MDEC_24                           23
#define __VSF_MDEC_25                           24
#define __VSF_MDEC_26                           25
#define __VSF_MDEC_27                           26
#define __VSF_MDEC_28                           27
#define __VSF_MDEC_29                           28
#define __VSF_MDEC_30                           29
#define __VSF_MDEC_31                           30
#define __VSF_MDEC_32                           31
#define __VSF_MDEC_33                           32
#define __VSF_MDEC_34                           33
#define __VSF_MDEC_35                           34
#define __VSF_MDEC_36                           35
#define __VSF_MDEC_37                           36
#define __VSF_MDEC_38                           37
#define __VSF_MDEC_39                           38
#define __VSF_MDEC_40                           39
#define __VSF_MDEC_41                           40
#define __VSF_MDEC_42                           41
#define __VSF_MDEC_43                           42
#define __VSF_MDEC_44                           43
#define __VSF_MDEC_45                           44
#define __VSF_MDEC_46                           45
#define __VSF_MDEC_47                           46
#define __VSF_MDEC_48                           47
#define __VSF_MDEC_49                           48
#define __VSF_MDEC_50                           49
#define __VSF_MDEC_51                           50
#define __VSF_MDEC_52                           51
#define __VSF_MDEC_53                           52
#define __VSF_MDEC_54                           53
#define __VSF_MDEC_55                           54
#define __VSF_MDEC_56                           55
#define __VSF_MDEC_57                           56
#define __VSF_MDEC_58                           57
#define __VSF_MDEC_59                           58
#define __VSF_MDEC_60                           59
#define __VSF_MDEC_61                           60
#define __VSF_MDEC_62                           61
#define __VSF_MDEC_63                           62
#define __VSF_MDEC_64                           63
#define __VSF_MDEC_65                           64
#define __VSF_MDEC_66                           65
#define __VSF_MDEC_67                           66
#define __VSF_MDEC_68                           67
#define __VSF_MDEC_69                           68
#define __VSF_MDEC_70                           69
#define __VSF_MDEC_71                           70
#define __VSF_MDEC_72                           71
#define __VSF_MDEC_73                           72
#define __VSF_MDEC_74                           73
#define __VSF_MDEC_75                           74
#define __VSF_MDEC_76                           75
#define __VSF_MDEC_77                           76
#define __VSF_MDEC_78                           77
#define __VSF_MDEC_79                           78
#define __VSF_MDEC_80                           79
#define __VSF_MDEC_81                           80
#define __VSF_MDEC_82                           81
#define __VSF_MDEC_83                           82
#define __VSF_MDEC_84                           83
#define __VSF_MDEC_85                           84
#define __VSF_MDEC_86                           85
#define __VSF_MDEC_87                           86
#define __VSF_MDEC_88                           87
#define __VSF_MDEC_89                           88
#define __VSF_MDEC_90                           89
#define __VSF_MDEC_91                           90
#define __VSF_MDEC_92                           91
#define __VSF_MDEC_93                           92
#define __VSF_MDEC_94                           93
#define __VSF_MDEC_95                           94
#define __VSF_MDEC_96                           95
#define __VSF_MDEC_97                           96
#define __VSF_MDEC_98                           97
#define __VSF_MDEC_99                           98
#define __VSF_MDEC_100                          99
#define __VSF_MDEC_101                          100
#define __VSF_MDEC_102                          101
#define __VSF_MDEC_103                          102
#define __VSF_MDEC_104                          103
#define __VSF_MDEC_105                          104
#define __VSF_MDEC_106                          105
#define __VSF_MDEC_107                          106
#define __VSF_MDEC_108                          107
#define __VSF_MDEC_109                          108
#define __VSF_MDEC_110                          109
#define __VSF_MDEC_111                          110
#define __VSF_MDEC_112                          111
#define __VSF_MDEC_113                          112
#define __VSF_MDEC_114                          113
#define __VSF_MDEC_115                          114
#define __VSF_MDEC_116                          115
#define __VSF_MDEC_117                          116
#define __VSF_MDEC_118                          117
#define __VSF_MDEC_119                          118
#define __VSF_MDEC_120                          119
#define __VSF_MDEC_121                          120
#define __VSF_MDEC_122                          121
#define __VSF_MDEC_123                          122
#define __VSF_MDEC_124                          123
#define __VSF_MDEC_125                          124
#define __VSF_MDEC_126                          125
#define __VSF_MDEC_127                          126
#define __VSF_MDEC_128                          127
#define __VSF_MDEC_129                          128
#define __VSF_MDEC_130                          129
#define __VSF_MDEC_131                          130
#define __VSF_MDEC_132                          131
#define __VSF_MDEC_133                          132
#define __VSF_MDEC_134                          133
#define __VSF_MDEC_135                          134
#define __VSF_MDEC_136                          135
#define __VSF_MDEC_137                          136
#define __VSF_MDEC_138                          137
#define __VSF_MDEC_139                          138
#define __VSF_MDEC_140                          139
#define __VSF_MDEC_141                          140
#define __VSF_MDEC_142                          141
#define __VSF_MDEC_143                          142
#define __VSF_MDEC_144                          143
#define __VSF_MDEC_145                          144
#define __VSF_MDEC_146                          145
#define __VSF_MDEC_147                          146
#define __VSF_MDEC_148                          147
#define __VSF_MDEC_149                          148
#define __VSF_MDEC_150                          149
#define __VSF_MDEC_151                          150
#define __VSF_MDEC_152                          151
#define __VSF_MDEC_153                          152
#define __VSF_MDEC_154                          153
#define __VSF_MDEC_155                          154
#define __VSF_MDEC_156                          155
#define __VSF_MDEC_157                          156
#define __VSF_MDEC_158                          157
#define __VSF_MDEC_159                          158
#define __VSF_MDEC_160                          159
#define __VSF_MDEC_161                          160
#define __VSF_MDEC_162                          161
#define __VSF_MDEC_163                          162
#define __VSF_MDEC_164                          163
#define __VSF_MDEC_165                          164
#define __VSF_MDEC_166                          165
#define __VSF_MDEC_167                          166
#define __VSF_MDEC_168                          167
#define __VSF_MDEC_169                          168
#define __VSF_MDEC_170                          169
#define __VSF_MDEC_171                          170
#define __VSF_MDEC_172                          171
#define __VSF_MDEC_173                          172
#define __VSF_MDEC_174                          173
#define __VSF_MDEC_175                          174
#define __VSF_MDEC_176                          175
#define __VSF_MDEC_177                          176
#define __VSF_MDEC_178                          177
#define __VSF_MDEC_179                          178
#define __VSF_MDEC_180                          179
#define __VSF_MDEC_181                          180
#define __VSF_MDEC_182                          181
#define __VSF_MDEC_183                          182
#define __VSF_MDEC_184                          183
#define __VSF_MDEC_185                          184
#define __VSF_MDEC_186                          185
#define __VSF_MDEC_187                          186
#define __VSF_MDEC_188                          187
#define __VSF_MDEC_189                          188
#define __VSF_MDEC_190                          189
#define __VSF_MDEC_191                          190
#define __VSF_MDEC_192                          191
#define __VSF_MDEC_193                          192
#define __VSF_MDEC_194                          193
#define __VSF_MDEC_195                          194
#define __VSF_MDEC_196                          195
#define __VSF_MDEC_197                          196
#define __VSF_MDEC_198                          197
#define __VSF_MDEC_199                          198
#define __VSF_MDEC_200                          199
#define __VSF_MDEC_201                          200
#define __VSF_MDEC_202                          201
#define __VSF_MDEC_203                          202
#define __VSF_MDEC_204                          203
#define __VSF_MDEC_205                          204
#define __VSF_MDEC_206                          205
#define __VSF_MDEC_207                          206
#define __VSF_MDEC_208                          207
#define __VSF_MDEC_209                          208
#define __VSF_MDEC_210                          209
#define __VSF_MDEC_211                          210
#define __VSF_MDEC_212                          211
#define __VSF_MDEC_213                          212
#define __VSF_MDEC_214                          213
#define __VSF_MDEC_215                          214
#define __VSF_MDEC_216                          215
#define __VSF_MDEC_217                          216
#define __VSF_MDEC_218                          217
#define __VSF_MDEC_219                          218
#define __VSF_MDEC_220                          219
#define __VSF_MDEC_221                          220
#define __VSF_MDEC_222                          221
#define __VSF_MDEC_223                          222
#define __VSF_MDEC_224                          223
#define __VSF_MDEC_225                          224
#define __VSF_MDEC_226                          225
#define __VSF_MDEC_227                          226
#define __VSF_MDEC_228                          227
#define __VSF_MDEC_229                          228
#define __VSF_MDEC_230                          229
#define __VSF_MDEC_231                          230
#define __VSF_MDEC_232                          231
#define __VSF_MDEC_233                          232
#define __VSF_MDEC_234                          233
#define __VSF_MDEC_235                          234
#define __VSF_MDEC_236                          235
#define __VSF_MDEC_237                          236
#define __VSF_MDEC_238                          237
#define __VSF_MDEC_239                          238
#define __VSF_MDEC_240                          239
#define __VSF_MDEC_241                          240
#define __VSF_MDEC_242                          241
#define __VSF_MDEC_243                          242
#define __VSF_MDEC_244                          243
#define __VSF_MDEC_245                          244
#define __VSF_MDEC_246                          245
#define __VSF_MDEC_247                          246
#define __VSF_MDEC_248                          247
#define __VSF_MDEC_249                          248
#define __VSF_MDEC_250                          249
#define __VSF_MDEC_251                          250
#define __VSF_MDEC_252                          251
#define __VSF_MDEC_253                          252
#define __VSF_MDEC_254                          253
#define __VSF_MDEC_255                          254
#define __VSF_MDEC_256                          255

/*============================ MACROFIED FUNCTIONS ===========================*/
/*============================ TYPES =========================================*/
/*============================ GLOBAL VARIABLES ==============================*/
/*============================ LOCAL VARIABLES ===============================*/
/*============================ PROTOTYPES ====================================*/



#ifdef __cplusplus
}
#endif

#endif      // __VSF_MACRO_CALC_H__
/* EOF */
